package com.online.teaching.dao;
import com.online.teaching.pojo.Takes;
import com.online.teaching.pojo.Teaches;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.special.InsertListMapper;

import java.util.List;

/****
 * @Author:admin
 * @Description:Takes的Dao
 * @Date 2019/6/14 0:12
 *****/
public interface TakesMapper extends Mapper<Takes>, InsertListMapper<Takes> {
    /**
     * 查询选修某一门课的学生的id列表
     * @param teachesId
     * @return
     */
    @Select("SELECT student_id FROM takes WHERE teaches_id=#{teaches_id} AND is_valid=1")
    List<Integer>getTeachesStudentList(@Param("teaches_id") Integer teachesId);

    /**
     * 查询一个学生的选课列表
     * @param studentId
     * @return
     */
    @Select("SELECT teaches_id FROM takes WHERE student_id=#{student_id} AND is_valid=1")
    List<Integer>getStudentTakesList(@ApiParam("student_id") Integer studentId);
}
